'''
Created on 14.10.2011

@author: hkh
'''

from CashFlowUtils.IceBonds import *
from Calendar.Iceland import *
from datetime import date
from datetime import timedelta

ddate1 = date(2011,8,2)
ddate2 = date(2012,1,15)

sec = RIKS300701()

secdirty = 78

yld = 0.07
while diff>0.01:
    price = sec.dirtyprice(ddate1,yld)
    yld -= 0.0001
    diff = secdirty-price
print yld


secdirty = 67.2

diff = 0

yld = 0.07
while diff>0.01:
    price = sec.dirtyprice(ddate1,yld)
    yld -= 0.0001
    diff = secdirty-price
print yld